apiready = function() {
    seajs.use(['../../V', "../../api", "../../jquery", "../../app", "../../service"], function(V, $api, $, app, service) {
        var vm = {
            el: '.vue-content',
            data: {
                imgList: [], //图片的数组
                imgChosen: '', //选中的图片字符串
                inds: '',
                num: '', //传进来的照片数
            },
            created: function() {
                this.imgList = api.pageParam.imgArr;
                this.num = this.imgList.length;
                this.inds = api.pageParam.inds;
                console.log(JSON.stringify(this.imgList));
            },
            mounted: function() {

            },

            methods: {
                //--点击返回按钮事件
                close: function() {
                    api.closeWin();
                },
                radioChecked: function(index) {
                    $('.imgChosen').prop('checked', false);
                    $('.imgChosen').eq(index).prop('checked', true);
                    this.imgChosen = $('.imgChosen').eq(index).val();
                    console.log(this.imgChosen);
                },
                getPictureS: function() {
                    var that = this
                    var maxlength = 20;
                    var leng = this.num;
                    var Upurl = service['fileupload'];
                    app.XcupLoad(maxlength, leng, Upurl, function(res) {
                        console.log('getPictureS上传图片：' + JSON.stringify(res));
                        if (res.length > 0) {
                            api.toast({
                                msg: '上传成功',
                                duration: 2000,
                                location: 'bottom'
                            });
                            that.num += res.length;
                            var arr1 = res.join(',');
                            var arr2 = that.imgList.join(',');
                            var arr3 = arr1 + ',' + arr2;
                            that.imgList = arr3.split(',');
                            console.log(JSON.stringify(that.imgList));
                        }
                    });
                },
                //--保存图片
                saveImg: function() {
                    if (this.imgChosen == '') {
                        api.toast({
                            msg: '请上传或选择图片',
                            duration: 2000,
                            location: 'middle'
                        });
                        return
                    }
                    api.sendEvent({
                        name: 'shopImgAdd',
                        extra: {
                            imgChosen: this.imgChosen, //选中的图片（字符串）
                            inds: this.inds,
                        }
                    });
                    api.closeWin()
                },
            }
        };
        // var shopVue = new Vue(vm);
        var even = function() {

        };
        var newVue = new Vue(vm);
        even();

    })
}
